#pragma once

#include "../include/faiss_index.h"
#include <map>

class IndexFactory {
public:
  enum class IndexType {
    FLAT,
    HNSW,
    UNKOWN = -1
  };

  enum class MetricType {
    L2,
    IP
  };

  /**
   * @brief 
   * @param Type 
   * @param dim
   * @param metric
   */
  void init(IndexFactory::IndexType Type, int dim,int num_data = 0, IndexFactory::MetricType metric = IndexFactory::MetricType::L2);

  /**
   * @brief
   * @param type
   * @return 
   */
  void* getIndex(IndexType type) const;

private:
  std::map<IndexType, void*> index_map;
};

IndexFactory* getGlobalIndexFactory();
